<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        let s = Symbol();
        console.log(s);
        let s1 = Symbol();
        let s2 = Symbol();
        console.log(s1, s2);
        console.log(s1 === s2)
        //带有描述符的创建
        let s3 = Symbol("name");
        let s4 = Symbol("age");
        console.log(s3, s4);
        console.log(s3 === s4);//false
        //模拟私有属性
        let a=Symbol("name")
        let b=Symbol("age");
        let obj={
            [a]: "小明",
            [b]: "18"
        }
        console.log(obj);
        console.log(obj[a]);
        console.log(obj[b]);
        console.log(obj.name,obj.age)//不能直接使用
        obj.name="张三"
        console.log(obj);
        
    </script>
</body>

</html>